/**
 * 
 */
package com.java.com.atlassian.jira_soapclient;

import java.text.DecimalFormat;

/**
 * @author suresh
 *
 */
public class Timing {
	private String operationDesc;
	private long then;

	private Timing(final String operationDesc) {
		this.operationDesc = operationDesc;
		this.then = System.currentTimeMillis();
	}

	static Timing startTiming(String operationDesc) {
		System.out.println("\nRunning : " + operationDesc);
		return new Timing(operationDesc);
	}

	void printTiming() {
		final long howLong = System.currentTimeMillis() - this.then;
		System.out
				.println("________________________________________________________________");
		DecimalFormat decFormat = new DecimalFormat("###,##0");
		System.out.println("\t" + this.operationDesc + " took "
				+ decFormat.format(howLong) + " ms to run");
	}
}

